<div id="wrapper-content">
<?php
    if($video_to_play->num_rows()>0){
        $vid = $video_to_play->row();
    }
?>
  <div class="titre_home" > <?php echo $vid->name;?></div>
<table style="margin-bottom:20px">
  
    <tr>
        <td style="font-size: smaller">
            Publié par: <font style="color: blue;font-weight: lighter"><?php echo $vid->display_name;?></font>
        </td>
    </tr>
    <tr>
        <td>
            <a
                href="<?php echo base_url().'assets/videos/'.$vid->file_name;?>"
                style="display:block;width:520px;height:330px"
                id="player">
            </a>
            <!-- this will install flowplayer inside previous A- tag. -->
            <script>
                flowplayer("player", "<?php echo base_url().'assets/flowplayer/'?>flowplayer-3.2.7.swf");
            </script>
        </td>
    </tr>
    <tr>
        <td style="font-size: small">
            Description: <?php echo $vid->description;?>
        </td>
    </tr>
</table>
<table class="titrepage" width="90%">
        <tr>
            <td align="left" style="font-size: medium;font-weight: lighter;color: #B7B7B7">Tous les commentaires (<?php echo $total;?>)</td>
  
        </tr>
</table>
<?php if($this->session->userdata('user_id')==TRUE){?>
    <?php echo form_open('media/comment_video'.'/'.$vid->id); ?>
                <table align="center">
                    <tr>
                        <td>Commentaire </td>
                        <td>  <?php if(validation_errors()!="") {?><div class="error_form"><?php echo validation_errors(); ?></div><?php } ?>
                            <textarea name="comment" id="comment" type="text" rows="3" cols="50"></textarea>
                            <br/><input type="submit" name="submit" value="Comment" />
                        </td>
                     
                    </tr>
                    
                </table>
<?php echo form_close(); ?>
<?php }?>
    <table align="center" width="100%" class="list" >
        
        <?php foreach ($video_comment as $aRow): ?>
        <?php
            $user_id = $aRow['user_id'];

            $image = './../assets/avatar/images/' . $aRow['gravatar'];
            if (file_exists($image) && $aRow['gravatar'] != null) {
                $image = root_url('seatting-falin') . 'assets/avatar/images/' . $aRow['gravatar'];
            } else {
                $image = root_url('seatting-falin') . 'assets/noimage.gif';
            }

            $long_date = $aRow['comment_date'];
            $posted_date = timespan($long_date, now());
        ?>
            <tr class="highlight">
                <td width="10%" valign="top" colspan="2">
                    <p><img border="0" src="<?php echo $image; ?>" width="60" alt=""/></p>
                </td>
                <td>
                    <p><?php echo $aRow['comment']; ?></p>
                    <p style="font-size: small;color: orangered"><?php echo $aRow['display_name']; ?> <span style="color: blue"><?php echo $posted_date; ?></span></p>
                </td>
        </tr>
        <?php endforeach; ?>
    </table>
    <?php echo $pagination; ?>
</div>